<template>
	<view class="home">
		<view class="active-body" v-for="v in activeData" :key="v.id">
			<navigator @click="titleMsg(v.title)" hover-class="navigator-hover">
				<view class="active-body-item">

					<view class="item-box"> <span class="iconfont icon-shequhuodong"></span> </view>
					<view class="item-text">
						<view class="top">
							<text>{{v.title}}</text>
						</view>
						<view class="bottom">
							<text>{{v.author.authorType}} {{v.date}}</text>
						</view>
					</view>
				</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	import {
		http
	} from "../../utils/http.js"
	export default {
		data() {
			return {
				activeData: [],
			};
		},
		methods: {
			titleMsg(v) {
				console.log(v)
				uni.navigateTo({
					url: '../articleDetails/articleDetails?title=' + v
				});
			},
			getData() {
				http({
					url: "/activity/list",
					method: "get",
					params: {
						page: 1,
						limit: 10000
					}
				}).then((res) => {
					// console.log(res)
					if (res.code == 0) {
						this.activeData = res.data;
					} else {
						console.log("数据接收失败")
					}

				})

			}
		},
		onLoad() {
			this.getData()
		},
	}
</script>

<style lang="less">
	@import url("../../static/font/iconfont.css");

	.home {
		padding: 40rpx;
		display: flex;
		flex-direction: column;

		.active-body {
			height: 100%;

			.active-body-item {
				border: 1px solid #e1e1e1;
				border-radius: 8px;
				height: 210rpx;
				margin: 20rpx 0;
				display: flex;
				justify-content: space-evenly;
				align-items: center;
				box-shadow: 0px 0px 15rpx rgba(0, 0, 0, .2);

				.item-box {
					width: 226rpx;
					height: 162rpx;
					background-color: #e6f1ff;
					border-radius: 8px;
					margin: 0 10px;
					display: flex;
					justify-content: center;
					align-items: center;
				}

				.item-text {
					flex: 1;

					.top {
						margin-bottom: 8px;
					}

					.bottom {
						font-size: 24rpx;
						color: #b8b8b8;
					}
				}
			}
		}
	}
</style>
